added controller folder with Route controller file#8
added controller folder with Route controller file#8narenkarthik370h wants to merge 1 commit intoInAndOut-Stack:mainfrom
Conversation
📝 WalkthroughWalkthroughA Java gradle build configuration was updated to use Java 21 toolchain, with additional source directories added. A new Spring REST controller for route management was introduced, exposing POST, GET, and DELETE endpoints that delegate to a RouteService. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java (1)
16-19: Add@Validto enforce request validation at the API boundary.Bean Validation annotations on
CreateRouteInputare not enforced unless the parameter is annotated with@Valid. Without it, invalid payloads bypass constraint checks.Suggested fix
+import jakarta.validation.Valid; ... public RouteSummary createRoute( `@PathVariable` String storeId, - `@RequestBody` CreateRouteInput request) { + `@Valid` `@RequestBody` CreateRouteInput request) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java` around lines 16 - 19, The createRoute API method in RouteController currently accepts CreateRouteInput without validation; annotate the request parameter with `@Valid` (e.g., change the method signature in RouteController.createRoute to accept `@Valid` `@RequestBody` CreateRouteInput request) and add the corresponding javax.validation.Valid or jakarta.validation.Valid import so Bean Validation constraints on CreateRouteInput are enforced at the API boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java`:
- Around line 9-37: Add explicit import statements for the Smithy-generated
types used by RouteController: RouteService, CreateRouteInput, and RouteSummary
— import them from the package declared in your Smithy-generated outputs (the
generated model/service package) at the top of RouteController.java so the
controller can compile; ensure the imported package matches the Smithy output
package and resolve any naming collisions by using fully qualified imports if
needed.
---
Nitpick comments:
In
`@src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java`:
- Around line 16-19: The createRoute API method in RouteController currently
accepts CreateRouteInput without validation; annotate the request parameter with
`@Valid` (e.g., change the method signature in RouteController.createRoute to
accept `@Valid` `@RequestBody` CreateRouteInput request) and add the corresponding
javax.validation.Valid or jakarta.validation.Valid import so Bean Validation
constraints on CreateRouteInput are enforced at the API boundary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 23bc9f48-4ac1-4433-b76a-f8bf14ccdf3d
📒 Files selected for processing (2)
build.gradle.ktssrc/main/java/com/shopping/inandout/routeservice/controller/RouteController.java
| private final RouteService routeService; | ||
|
|
||
| public RouteController(RouteService routeService) { | ||
| this.routeService = routeService; | ||
| } | ||
|
|
||
| @PostMapping | ||
| public RouteSummary createRoute( | ||
| @PathVariable String storeId, | ||
| @RequestBody CreateRouteInput request) { | ||
|
|
||
| return routeService.createRoute(storeId, request); | ||
| } | ||
|
|
||
| @GetMapping("/{routeId}") | ||
| public RouteSummary getRoute( | ||
| @PathVariable String storeId, | ||
| @PathVariable String routeId) { | ||
|
|
||
| return routeService.getRoute(storeId, routeId); | ||
| } | ||
|
|
||
| @DeleteMapping("/{routeId}") | ||
| public RouteSummary deleteRoute( | ||
| @PathVariable String storeId, | ||
| @PathVariable String routeId) { | ||
|
|
||
| return routeService.deleteRoute(storeId, routeId); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "RouteController imports and referenced symbols:"
sed -n '1,80p' src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java
echo
echo "Locate declarations for RouteService, CreateRouteInput, RouteSummary:"
rg -n --type=java -C2 '^\s*(public\s+)?(class|interface|record)\s+(RouteService|CreateRouteInput|RouteSummary)\b|^\s*package\s+'Repository: InAndOut-Stack/InAndOut-Route-Service
Length of output: 2238
🏁 Script executed:
# Search for RouteService definition
echo "=== Searching for RouteService ==="
rg -n "class\s+RouteService|interface\s+RouteService" --type=java
echo
echo "=== Searching for CreateRouteInput definition ==="
rg -n "class\s+CreateRouteInput|record\s+CreateRouteInput" --type=java
echo
echo "=== Searching for RouteSummary definition ==="
rg -n "class\s+RouteSummary|record\s+RouteSummary|interface\s+RouteSummary" --type=java
echo
echo "=== All Java files in src/main ==="
find src/main -name "*.java" -type fRepository: InAndOut-Stack/InAndOut-Route-Service
Length of output: 649
🏁 Script executed:
# Check for build files
echo "=== Build files ==="
ls -la | grep -E "pom.xml|build.gradle|build.gradle.kts"
# Check pom.xml for dependencies if it exists
if [ -f pom.xml ]; then
echo
echo "=== pom.xml dependencies ==="
head -50 pom.xml
fi
# Check if RouteController file is complete
echo
echo "=== Full RouteController.java ==="
cat src/main/java/com/shopping/inandout/routeservice/controller/RouteController.javaRepository: InAndOut-Stack/InAndOut-Route-Service
Length of output: 1210
🏁 Script executed:
cat build.gradle.ktsRepository: InAndOut-Stack/InAndOut-Route-Service
Length of output: 3815
Add missing imports for Smithy-generated types.
RouteService, CreateRouteInput, and RouteSummary are generated by Smithy and are not in the controller package. This file requires explicit imports for these types to compile.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/main/java/com/shopping/inandout/routeservice/controller/RouteController.java`
around lines 9 - 37, Add explicit import statements for the Smithy-generated
types used by RouteController: RouteService, CreateRouteInput, and RouteSummary
— import them from the package declared in your Smithy-generated outputs (the
generated model/service package) at the top of RouteController.java so the
controller can compile; ensure the imported package matches the Smithy output
package and resolve any naming collisions by using fully qualified imports if
needed.
|
@petrubraha can you check and give review over this |
| java { | ||
| toolchain { | ||
| languageVersion = JavaLanguageVersion.of(25) | ||
| languageVersion = JavaLanguageVersion.of(21) |
There was a problem hiding this comment.
indeed, a more stable version would be better
hi, yess since the last time we spoke, i integerated the smithy tool into the project. i created the driver code that can be explored right now in the main branch. instead of having a route controller we use a smithy service that handles the routing between operations: POST, GET, DELETE.
the chore tasks should be over for now. what we need to further do is to implement:
context of my vision of the project can be seen here: https://github.com/InAndOut-Stack/.github/blob/main/doc/system-requirements.md#scalability-requirements. Also i deleted the old google docs link. everything about the project is here, on the github organization. we don't need to rush to implementation, feel free to debate, propose better alternatives, and challenge my ideas. my overall goal is to learn system design, we can achieve that together. |
Concretely speaking: for this PR let's implement the GET operationYou can set up a database locally and write some code. I will soon create a PR for the DELETE activity and then we can review each other's work. how does it sound? feel free to be sincere with me, and don't hesitate to break my ideas down. thank you again for your support. |



Implements the Route API endpoints defined in the Smithy model:
POST /api/stores/{storeId}/routes
GET /api/stores/{storeId}/routes/{routeId}
DELETE /api/stores/{storeId}/routes/{routeId}
Controller delegates logic to RouteService.
Summary by CodeRabbit
New Features
Chores